#ifndef __IIC_H_
#define __IIC_H_

#include "board.h"

#define Fast_I2C 1//mpu6050启用

#define IIC1 1
#define IIC2 0

#define YES 1
#define NO  0

#define SCL1_H         I2C1_PORT->BSRRL = I2C1_Pin_SCL
#define SCL1_L         I2C1_PORT->BSRRH = I2C1_Pin_SCL
#define SDA1_H         I2C1_PORT->BSRRL = I2C1_Pin_SDA
#define SDA1_L         I2C1_PORT->BSRRH = I2C1_Pin_SDA
#define SDA1_read      I2C1_PORT->IDR   & I2C1_Pin_SDA

#define SCL2_H         I2C2_PORT->BSRRL = I2C2_Pin_SCL
#define SCL2_L         I2C2_PORT->BSRRH = I2C2_Pin_SCL
#define SDA2_H         I2C2_PORT->BSRRL = I2C2_Pin_SDA
#define SDA2_L         I2C2_PORT->BSRRH = I2C2_Pin_SDA
#define SDA2_read      I2C2_PORT->IDR   & I2C2_Pin_SDA

void IIC_Init(u8 IIC);
void I2C_Delay(void);
int  I2C_Start(u8 IIC);
void I2C_Stop(u8 IIC);
void I2C_Ack(u8 IIC,u8 Mod);
int  I2C_WaitAck(u8 IIC);
void I2C_SendByte(u8 IIC,u8 SendByte);
u8   I2C_ReadByte(u8 IIC);

 int I2C1_Single_Write(u8 SlaveAddress,u8 REG_Address,u8 REG_data);
 int I2C1_Single_Read(u8 SlaveAddress,u8 REG_Address);
 int I2C1_Mult_Read(u8 SlaveAddress,u8 REG_Address,u8 * ptChar,u8 size);

#endif
